﻿@model IEnumerable<SGC_CarteraClientes.Models.CA_CAMPANIA>

@{
    ViewBag.Title = "Gestion de Campañas";
}

<h2>Campañas</h2>
@if (TempData["message"] != null && TempData["message"].ToString().Trim()!="")
{
@Html.Raw(TempData["message"].ToString())
//@TempData["message"] = null;
} 
<hr />
    @Html.ActionLink("Generar Campaña", "Create")
    @Html.ActionLink("Volver", "../")

<table class="tblSort">
    <thead>
    <tr>
        <th>
             @Html.DisplayName("Código")
        </th>
        <th>
             @Html.DisplayName("Descripción")
        </th>
        <th>
             @Html.DisplayName("F. Ini Vig")
        </th>
        <th>
            @Html.DisplayName("F. Fin Vig")
        </th>
        <th>
            @Html.DisplayName("Param. Camp")
        </th>
        <th>
            @Html.DisplayName("% Comi")
        </th>
        <th>
            @Html.DisplayName("% Desc")
        </th>
        <th>
            @Html.DisplayName("Estado")
        </th>
        <th></th>
    </tr>
</thead><tbody>
@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.CAMP_ID)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CAMP_DESCRIP)
        </td>
        <td>
            @item.CAMP_FINIV.Value.ToShortDateString()
        </td>
        <td>
            @item.CAMP_FINV.Value.ToShortDateString()
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CA_PARAMETRO_CAMPANIA.PARAM_DES)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CAMP_PORCOMI)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.CAMP_DCTO)
        </td>
        <td  align="center">
            @if (item.CAMP_ESTADO == "1")
            { 
             <img src="/Images/active.png"  width="25px" />   
            }
            else {
                <img src="/Images/inactive.png"  width="25px" />        
            }
        </td>
        <td>
            @if (item.CAMP_ESTADO == "1") {
            @Html.ActionLink("Modificar", "Edit", new { id=item.CAMP_ID })} else {
            @Html.ActionLink("Activar", "Edit", new { id=item.CAMP_ID })}|
            
            @Html.ActionLink("Ver", "Details", new { id=item.CAMP_ID }) |
            @if (item.CAMP_ESTADO == "1") {
            @Html.ActionLink("Desactivar", "Delete", new { id=item.CAMP_ID })}
        </td>
    </tr>
}
 </tbody>
</table>
